package com.example.demo.respository;

import com.example.demo.model.User;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

public interface TestRepository extends CrudRepository<User, Long> {


    @Query(value = "select user0_.id as id1_0_, user0_.age as age2_0_, user0_.email as email3_0_, user0_.name as name4_0_ from user user0_", nativeQuery = true)
        //fail
    List<User> findUserList(String name);


    List<User> findUserByName(String name, Pageable page);

    List<User> findByname(String name);//success

    List<User> findBynameAndAge(String name, String age);//success

    List<User> findBynameLike(String name);//success

    List<User> findUserByAgeIsNot(String age);

    List<User> findFirstByAge(String age);

    List<User> findByIdBefore(Long id);

    List<User> findByIdBetween(Long id1,Long id2);

    List<User> findByIdLessThan(Long id1);
//    List<User> findAll(Pageable page);

    @Override
    void delete(User user);

    void  deleteById(Long id);
}
